// API响应类型
export interface ApiResponse<T = any> {
  success: boolean;
  data?: T;
  message?: string;
  error?: string;
}

// 分页响应类型
export interface PaginatedResponse<T> {
  items: T[];
  total: number;
  page: number;
  limit: number;
  totalPages: number;
}

// 错误类型
export interface ApiError {
  message: string;
  code?: string;
  details?: any;
}

// 游戏创建参数类型
export interface CreateGameParams {
  name: string;
  maxPlayers: number;
  minBet: number;
}

// 用户注册参数类型
export interface RegisterParams {
  username: string;
  email: string;
  password: string;
}

// 用户登录参数类型
export interface LoginParams {
  username: string;
  password: string;
}

// 游戏动作类型
export type GameActionType = 'check' | 'call' | 'raise' | 'fold' | 'all-in';

// 游戏动作参数类型
export interface GameActionParams {
  type: GameActionType;
  amount?: number;
}

// Socket事件类型
export interface SocketEvents {
  // 客户端发送的事件
  'game:join': { gameId: string };
  'game:leave': { gameId: string };
  'game:action': { gameId: string; action: GameActionType; amount?: number };
  'game:start': { gameId: string };
  
  // 服务器发送的事件
  'games:list': any[];
  'game:state': any;
  'game:player_joined': any;
  'game:player_left': string;
  'game:chips_updated': { playerId: string; chips: number };
  'game:community_cards': any[];
  'game:phase': any;
  'game:pot': number;
  'game:current_bet': number;
  'game:current_player': number;
  'game:player_actions': any;
}

// 导航路径类型
export type NavigationPath = '/' | '/login' | '/register' | '/lobby' | '/game/:id';

// 组件Props类型
export interface BaseComponentProps {
  className?: string;
  children?: React.ReactNode;
}

// 表单字段类型
export interface FormField {
  name: string;
  label: string;
  type: 'text' | 'email' | 'password' | 'number';
  required?: boolean;
  placeholder?: string;
  value?: string;
  error?: string;
}

// 表单状态类型
export interface FormState {
  [key: string]: string;
}

// 表单验证规则类型
export interface ValidationRule {
  required?: boolean;
  minLength?: number;
  maxLength?: number;
  pattern?: RegExp;
  custom?: (value: string) => string | undefined;
}

// 表单验证规则集合类型
export interface ValidationRules {
  [key: string]: ValidationRule;
}